package com.lxw.oa.service.serviceImpl;

import com.lxw.oa.mapper.BaseMapper;
import com.lxw.oa.mapper.SearchMapper;
import com.lxw.oa.service.DataSearchService;
import com.lxw.oa.util.BootstrapTable;
import com.lxw.oa.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service("dataSearchService")
@Transactional
public class DataSearchServiceImpl implements DataSearchService {

    @Autowired
    private SearchMapper searchMapper;


    @Override
    public List<Map<String, Object>> getPage(BootstrapTable bootstrapTable) {
        String content = (String) bootstrapTable.getParams().get("content_like");
        Map<String,Object> map=new HashMap<String,Object>();
        map=bootstrapTable.getParams();
        int pageS=bootstrapTable.getPageSize()*(bootstrapTable.getPageNo()-1);
        map.put("pageS",pageS);
        map.put("pageE",bootstrapTable.getPageSize());
        map.put("sort",bootstrapTable.getSort());
        map.put("order",bootstrapTable.getOrder());

      //  return  searchMapper.getPage(map);
        return  null;
    }

    @Override
    public List<Map<String, Object>> getCnt(BootstrapTable bootstrapTable) {
        Map<String,Object> map=new HashMap<String,Object>();
        map=bootstrapTable.getParams();
        String sqlStr=StringUtil.toSqlSearchStr(map);
        map.put("sqlStr",sqlStr);
      //  return searchMapper.getCnt(map);
        return new ArrayList<Map<String, Object>>();
    }
}
